package com.gr.service.impl;

import com.gr.entity.Book;
import com.gr.mapper.BookMapper;
import com.gr.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class BookServiceImpl implements BookService {
    @Autowired
    private BookMapper bookMapper;
    @Override
    public List<Book> selectAllBook() {
        return bookMapper.selectAllBook();
    }

    @Override
    public List<Book> selectAllBookAndType() {
        return bookMapper.selectAllBookAndType();
    }

    @Override
    public Book selectBookById(Integer id) {
        return bookMapper.selectBookById(id);//返回值没写
    }

    @Override
    public void insertBook(Book book) {
        bookMapper.insertBook(book);
    }

    @Override
    public void deleteBookById(Integer id) {
        bookMapper.deleteBookById(id);
    }

    @Override
    public void updateBook(Book book) {
        bookMapper.updateBook(book);
    }

    @Override
    public void deleteBookByTid(Integer tid) {
        bookMapper.deleteBookByTid(tid);
    }

    @Override
    public List<Book> selectBookByTypeId(Integer tid) {
        return bookMapper.selectBookByTypeId(tid);
    }
}
